<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActionController::Routing::RouteSet::Mapper</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActionController::Routing::RouteSet::Mapper</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../../files/vendor/rails/actionpack/lib/action_controller/routing_rb.html">
                vendor/rails/actionpack/lib/action_controller/routing.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
<a href="Mapper.html">Mapper</a> instances are used to build routes. The
object passed to the draw block in config/routes.rb is a <a
href="Mapper.html">Mapper</a> instance.
</p>
<p>
<a href="Mapper.html">Mapper</a> instances have relatively few instance
methods, in order to avoid clashes with named routes.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000349">connect</a>&nbsp;&nbsp;
      <a href="#M000351">namespace</a>&nbsp;&nbsp;
      <a href="#M000350">root</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000349" class="method-detail">
        <a name="M000349"></a>

        <div class="method-heading">
          <a href="#M000349" class="method-signature">
          <span class="method-name">connect</span><span class="method-args">(path, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Create an unnamed route with the provided <tt>path</tt> and
<tt>options</tt>. See <a
href="../../Routing.html">ActionController::Routing</a> for an introduction
to routes.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000349-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000349-source">
<pre>
      <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/routing.rb, line 1064</span>
1064:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connect</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {})
1065:           <span class="ruby-ivar">@set</span>.<span class="ruby-identifier">add_route</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span>)
1066:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000351" class="method-detail">
        <a name="M000351"></a>

        <div class="method-heading">
          <a href="#M000351" class="method-signature">
          <span class="method-name">namespace</span><span class="method-args">(name, options = {}, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Enables the use of resources in a module by setting the name_prefix,
path_prefix, and <a href="Mapper.html#M000351">namespace</a> for the model.
Example:
</p>
<pre>
  map.namespace(:admin) do |admin|
    admin.resources :products,
      :has_many =&gt; [ :tags, :images, :variants ]
  end
</pre>
<p>
This will create <tt>admin_products_url</tt> pointing to
&quot;admin/products&quot;, which will look for an
Admin::ProductsController. It&#8216;ll also create
<tt>admin_product_tags_url</tt> pointing to
&quot;admin/products/#{product_id}/tags&quot;, which will look for
Admin::TagsController.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000351-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000351-source">
<pre>
      <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/routing.rb, line 1088</span>
1088:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">namespace</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
1089:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:namespace</span>]
1090:             <span class="ruby-identifier">with_options</span>({<span class="ruby-identifier">:path_prefix</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{options.delete(:path_prefix)}/#{name}&quot;</span>, <span class="ruby-identifier">:name_prefix</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{options.delete(:name_prefix)}#{name}_&quot;</span>, <span class="ruby-identifier">:namespace</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{options.delete(:namespace)}#{name}/&quot;</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>), <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
1091:           <span class="ruby-keyword kw">else</span>
1092:             <span class="ruby-identifier">with_options</span>({<span class="ruby-identifier">:path_prefix</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">:name_prefix</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{name}_&quot;</span>, <span class="ruby-identifier">:namespace</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{name}/&quot;</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>), <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
1093:           <span class="ruby-keyword kw">end</span>
1094:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000350" class="method-detail">
        <a name="M000350"></a>

        <div class="method-heading">
          <a href="#M000350" class="method-signature">
          <span class="method-name">root</span><span class="method-args">(options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates a named route called &quot;<a
href="Mapper.html#M000350">root</a>&quot; for matching the <a
href="Mapper.html#M000350">root</a> level request.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000350-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000350-source">
<pre>
      <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/routing.rb, line 1069</span>
1069:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">root</span>(<span class="ruby-identifier">options</span> = {})
1070:           <span class="ruby-identifier">named_route</span>(<span class="ruby-value str">&quot;root&quot;</span>, <span class="ruby-value str">''</span>, <span class="ruby-identifier">options</span>)
1071:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>